<template>
  <div>
    <h2>我的付款单</h2>
    <!--  <el-table :data="tableData" @selection-change="handleSelectionChange">-->
    <el-table :data="tableData">
      <!--    <el-table-column type="selection" width="55" align="center" />-->
      <el-table-column label="编号" align="center" prop="id"/>
      <el-table-column label="付款单号" align="center" prop="receiptOrderNo"/>
      <el-table-column label="合同编号" align="center" prop="contractNo"/>
      <el-table-column label="应付日期" align="center" prop="paymentDaysEnd"/>
      <el-table-column label="金额" align="center" prop="paymentAmount"/>
      <!--      <el-table-column label="租赁方式" align="center" prop="rentMethod" />-->
      <el-table-column label="支付状态" align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.skStatus==0">未付款</span>
          <span v-if="scope.row.skStatus==1">已付款</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-button @click="payMent(scope.row)">支付</el-button>
        </template>
      </el-table-column>
    </el-table>

  </div>
</template>

<script>
export default {
  // 我的付款单
  name: 'PayMent',
  data () {
    return {
      tableData: []
    }
  },
  created () {
    this.initTable()
  },
  methods: {
    initTable () {
      this.axios.get('/accounting/plan/list').then(res => {
        this.tableData = res.data.rows
      })
    },
    payMent (row) {
      this.axios.post('/accounting/payOrder/pays/', row).then(res => {
        if (res.data.code === 200) {
          window.open(res.data.data.data.payData)
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
